/**
 * 创建一对多头标签
 */
function createOneTwoManyHeader(){
    validatorDestroy('defaultOneTwoManyForm');
    $("#one_two_many_tables_rows").empty();
    var rowsHtml =
        '<div class="form-group m-form__group row" style="background: #6f47d0;">'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_name">表名</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_label">描述</label>'+
            '<label class="col-lg-2 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_label_position">实体层包</label>'+
            '<label class="col-lg-2 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_label_length">数据层包</label>'+
            '<label class="col-lg-2 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_flag">业务层包</label>'+
            '<label class="col-lg-2 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_type">控制层包</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="xt_script_id">外键</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="xt_generator_search_type">操作</label>'+
        '</div>';
    $("#one_two_many_tables_rows").append(rowsHtml);
    reValidator('defaultOneTwoManyForm');
}


function getXtGeneratorOneToManyFormListJSON() {
    var bootform = $('#defaultOneTwoManyForm');
    var boostrapValidator =bootform.data('bootstrapValidator');
    boostrapValidator.validate();
    if(!boostrapValidator.isValid()){
        window.parent.toastrBoot(4,"存在不合法的字段!");
        return false;
    }
    // $.fn.serializeObject = function(){
    //     var o = {};
    //     var a = this.serializeArray();
    //     $.each(a, function() {
    //         if (o[this.name] !== undefined) {
    //             if (!o[this.name].push) {
    //                 o[this.name] = [o[this.name]];
    //             }
    //             o[this.name].push(this.value || '');
    //         } else {
    //             o[this.name] = this.value || '';
    //         }
    //     });
    //     return o;
    // };

    return JSON.stringify($("#defaultOneTwoManyForm").serializeJSON());
}


/**
 * 创建一行从表信息
 */
function newOneTwoManyRows() {
    var xt_dbinfo_id = $("#xt_dbinfo_id").val()
    if(undefined === xt_dbinfo_id||null == xt_dbinfo_id || "" == xt_dbinfo_id){
        window.parent.toastrBoot(2, "请到后台配置选项卡中选择数据源");
        return;
    }
    var newOneTwoManyModalCount = 0 ;
    $('#oneTwoManyModal').modal({backdrop: 'static', keyboard: false});
    $('#oneTwoManyModal').on("shown.bs.modal",function(){
        if(++newOneTwoManyModalCount == 1){
            getOneTowManyTablesList(xt_dbinfo_id);
        }
    });
}



/**
 * 获取一对多表集合供筛选使用
 */
function getOneTowManyTablesList(xt_dbinfo_id){
    var tableGrid;
    /////////////jehc扩展属性目的可方便使用（boot.js文件datatablesCallBack方法使用） 如弹窗分页查找根据条件 可能此时的form发生变化 此时 可以解决该类问题
    var opt = {
        searchformId:'oneTwoManyForm'
    };
    var options = DataTablesList.listOptions({
        ajax:function (data, callback, settings){datatablesListCallBack(data, callback, settings,"../xtGenerator/table/list?xt_dbinfo_id="+xt_dbinfo_id,opt);},//渲染数据
        //在第一位置追加序列号
        fnRowCallback:function(nRow, aData, iDisplayIndex){
            jQuery('td:eq(0)', nRow).html(iDisplayIndex+1);
            return nRow;
        },
        order:[],//取消默认排序查询,否则复选框一列会出现小箭头
        //列表表头字段
        colums:[
            {
                data:"table_NAME",
                width:"50px"
            },
            {
                data:"table_NAME",
                width:"150px",
                render:function(data, type, row, meta) {
                    var TABLE_NAME = row.table_NAME;
                    var TABLE_COMMENT = row.table_COMMENT;
                    return '<a href=javascript:doSelectTableCol("'+TABLE_NAME+'","'+TABLE_COMMENT+'")  class="btn btn-default">确定</a>';
                }
            },
            {
                data:'table_NAME'
            },
            {
                data:'table_COMMENT'
            }
        ]
    });
    $('#oneTwoManyDatatables').dataTable(options);
}



/**
 * 动态创建从表框
 */
function createOneTwoManyField(uuid){
    var rowsHtml =
        '<div class="form-group m-form__group row" id="rows'+uuid+'">'+
            '<div class="col-lg-1">'+
                '<input class="form-control" type="text" readonly id="xt_generator_one_to_many_table_name'+uuid+'"  name="oneToManyList[][xt_generator_one_to_many_table_name]">'+
                '<input class="form-control" type="hidden" readonly id="xt_generator_ontomany_grid'+uuid+'"  name="oneToManyList[][xt_generator_ontomany_grid]">'+
            '</div>'+
            '<div class="col-lg-1">'+
                '<input class="form-control" type="text"  id="xt_generator_one_to_many_table_name_zh'+uuid+'" data-bv-notempty data-bv-notempty-message="请输入表描述" name="oneToManyList[][xt_generator_one_to_many_table_name_zh]" placeholder="请输入表描述">'+
            '</div>'+
            '<div class="col-lg-2">'+
                '<input class="form-control" type="text"  id="xt_generator_one_to_many_table_model_package'+uuid+'" data-bv-notempty data-bv-notempty-message="请输入实体包路径" name="oneToManyList[][xt_generator_one_to_many_table_model_package]" placeholder="请输入实体包路径">'+
            '</div>'+
            '<div class="col-lg-2">'+
                '<input class="form-control" type="text" id="xt_generator_one_to_many_table_dao_package'+uuid+'" data-bv-notempty data-bv-notempty-message="请输入数据层包路径" name="oneToManyList[][xt_generator_one_to_many_table_dao_package]" placeholder="请输入数据层包路径">'+
            '</div>'+
            '<div class="col-lg-2">'+
                '<input class="form-control" type="text" id="xt_generator_one_to_many_table_service_package'+uuid+'" data-bv-notempty data-bv-notempty-message="请输入业务层包路径" name="oneToManyList[][xt_generator_one_to_many_table_service_package]" placeholder="请输入业务层包路径">'+
            '</div>'+
            '<div class="col-lg-2">'+
                '<input class="form-control" type="text" id="xt_generator_one_to_many_table_web_package'+uuid+'" data-bv-notempty data-bv-notempty-message="请输入控制层包路径" name="oneToManyList[][xt_generator_one_to_many_table_web_package]" placeholder="请输入控制层包路径">'+
            '</div>'+
            '<div class="col-lg-1">'+
                '<input class="form-control" type="text" readonly id="xt_generator_one_to_many_table_fkey'+uuid+'" data-bv-notempty data-bv-notempty-message="请选择外键" name="oneToManyList[][xt_generator_one_to_many_table_fkey]" placeholder="请选择外键">'+
            '</div>'+
            '<div class="col-lg-1">'+
                '<a href=javascript:addOneTwoManyFKey("'+uuid+'")  class="btn btn-outline-accent m-btn m-btn--icon m-btn--icon-only m-btn--pill m-btn--air" title="选择外键"><i class="fa flaticon-edit"></i></a>'+
                '<a href=javascript:addOneTwoManyField("'+uuid+'")  class="btn btn-outline-brand m-btn m-btn--icon m-btn--icon-only m-btn--pill m-btn--air" title="配置字段"><i class="la la-plus"></i></a>'+
                '<a href=javascript:delOneTwoManyRows("'+uuid+'")  class="btn btn-outline-danger m-btn m-btn--icon m-btn--icon-only m-btn--pill" title="删 除"><i class="la la-trash"></i></a>'+
            '</div>'
        '</div>';
    return rowsHtml;
}

/**
 * 删除行
 * @param uuid
 */
function delOneTwoManyRows(rowID) {
    msgTishCallFnBoot("确认删除？",function(){
        validatorDestroy('defaultOneTwoManyForm');
        $("#rows"+rowID).remove();
        reValidator('defaultOneTwoManyForm');
    });
}

/**
 * 确定选择
 */
function doSelectTableCol(table_NAME,table_COMMENT){
    var tabName = $("#xt_generator_tbname").val();
    if(tabName == table_NAME){
        window.parent.toastrBoot(2, "您选择的该表不能与主表一样，请重新选择！");
        return;
    }
    var array = document.getElementsByName("xt_generator_one_to_many_table_name");
    for(var i in array){
        if(array[i].value == table_NAME){
            window.parent.toastrBoot(2, "您选择的该表已经设置过了，不能再次设置！");
            return;
        }
    }
    msgTishCallFnBoot("确认选择表："+table_NAME+",<br>标签为："+table_COMMENT+"?",function(){
        validatorDestroy('defaultOneTwoManyForm');
        var uuid = guid();
        $("#one_two_many_tables_rows").append(createOneTwoManyField(uuid));
        $('#xt_generator_one_to_many_table_name'+uuid).val(table_NAME);
        $('#xt_generator_one_to_many_table_name_zh'+uuid).val(table_COMMENT);
        reValidator('defaultOneTwoManyForm');
        $('#oneTwoManyModal').modal('hide');
    });
}

/**
 * 选择外键
 */
function addOneTwoManyFKey(id){
    var xt_dbinfo_id = $("#xt_dbinfo_id").val()
    if(undefined === xt_dbinfo_id||null == xt_dbinfo_id || "" == xt_dbinfo_id){
        window.parent.toastrBoot(2, "请到后台配置选项卡中选择数据源");
        return;
    }
    var oneTwoManyFkeyModalCount = 0 ;
    $('#oneTwoManyFkeyModal').modal({backdrop: 'static', keyboard: false});
    $('#oneTwoManyFkeyModal').on("shown.bs.modal",function(){
        if(++oneTwoManyFkeyModalCount == 1){
            commonField(id,0)
        }
    });

}

/**
 * 一对多外键字段选择器
 * @param type 0外键选择 1字段配置
 */
function commonField(id,type){
    var xt_dbinfo_id = $('#xt_dbinfo_id').val();
    if(null == xt_dbinfo_id || '' == xt_dbinfo_id){
        toastrBoot(4,"请选择数据源");
        return;
    }
    var xt_generator_tbname = $("#xt_generator_one_to_many_table_name"+id).val();
    /////////////jehc扩展属性目的可方便使用（boot.js文件datatablesCallBack方法使用） 如弹窗分页查找根据条件 可能此时的form发生变化 此时 可以解决该类问题
    var opt = {
        searchformId:'searchForm'
    };
    var options = DataTablesList.listOptions({
        ajax:function (data, callback, settings){datatablesListCallBack(data, callback, settings,"../xtGenerator/table/column/list?xt_generator_tbname="+xt_generator_tbname+"&xt_dbinfo_id="+xt_dbinfo_id,opt);},//渲染数据
        //在第一位置追加序列号
        fnRowCallback:function(nRow, aData, iDisplayIndex){
            jQuery('td:eq(0)', nRow).html(iDisplayIndex+1);
            return nRow;
        },
        order:[],//取消默认排序查询,否则复选框一列会出现小箭头
        //列表表头字段
        colums:[
            {
                data:"column_NAME",
                width:"50px"
            },
            {
                data:"column_NAME",
                width:"150px",
                render:function(data, type, row, meta) {
                    var column_NAME = row.column_NAME;
                    var column_COMMENT = row.column_COMMENT;
                    return '<a href=javascript:doSelectOneTwoManyFkey("'+id+'","'+column_NAME+'","'+column_COMMENT+'")  class="btn btn-default">确 定</a>';
                }
            },
            {
                data:'column_NAME'
            },
            {
                data:'column_COMMENT'
            },
            {
                data:'data_TYPE'
            },
            {
                data:'character_MAXIMUM_LENGTH'
            },
            {
                data:'is_NULLABLE'
            }
        ]
    });
    $('#oneTwoManyFkeyDatatables').dataTable(options);
}

/**
 * 执行选择外键
 * @param column_NAME
 * @param column_COMMENT
 */
function doSelectOneTwoManyFkey(id,column_NAME,column_COMMENT) {
    msgTishCallFnBoot("确认选择字段名："+column_NAME+",<br>标签为："+column_COMMENT+"?",function(){
        validatorDestroy('defaultOneTwoManyForm');
        $('#xt_generator_one_to_many_table_fkey'+id).val(column_NAME);
        reValidator('defaultOneTwoManyForm');
        $('#oneTwoManyFkeyModal').modal('hide');
    });
}

/**
 * 配置一对多从表字段
 * @param id
 */
function addOneTwoManyField(id) {
    var xt_dbinfo_id = $("#xt_dbinfo_id").val()
    if(undefined === xt_dbinfo_id||null == xt_dbinfo_id || "" == xt_dbinfo_id){
        window.parent.toastrBoot(2, "请到后台配置选项卡中选择数据源");
        return;
    }
    var oneTwoManyFieldsModalCount = 0 ;
    $('#oneTwoManyFieldsBody').height(reGetBodyHeight()*0.7);
    $('#oneTwoManyFieldsModal').modal({backdrop: 'static', keyboard: false});
    $('#oneTwoManyFieldsModal').on("shown.bs.modal",function(){
        $('#defaultOneTwoManyPageConfigForm')[0].reset();
        $("#otmtm").val($("#xt_generator_one_to_many_table_name"+id).val());
        $("#otmtmId").val(id);
        if(++oneTwoManyFieldsModalCount == 1){
            initOneTwoManyFields(xt_dbinfo_id,$("#xt_generator_one_to_many_table_name"+id).val(),id);
        }
    });
}


/**
 * 创建一对多从表字段列表
 * @param xt_dbinfo_id
 * @param xt_generator_tbname
 * @param id 当前行id即uuid
 */
function initOneTwoManyFields(xt_dbinfo_id,xt_generator_tbname,id) {
    createOneTwoManyPageConfigColumnHeader();
    var rowsHtml;
    ajaxBRequestCallFn("../xtGenerator/table/column/list?xt_generator_tbname="+xt_generator_tbname+"&xt_dbinfo_id="+xt_dbinfo_id,{},function(result){
        result = result.data;
        $.each(result, function(i, item){
            var column_NAME = item.column_NAME;
            var column_COMMENT = item.column_COMMENT;
            if(null == column_COMMENT || "" == column_COMMENT){
                column_COMMENT =  column_NAME;
            }
            var column_KEY = item.column_KEY;
            if(column_KEY ==  null){
                column_KEY = "";
            }
            validatorDestroy('defaultOneTwoManyPageConfigForm');
            var uuid = i+id;
            rowsHtml =
                '<div class="form-group m-form__group row" id="pageRows'+uuid+'">'+
                    '<div class="col-lg-2">'+
                        '<input class="form-control" type="text" readonly id="page_column_NAME'+uuid+'" value="'+column_NAME+'"  name="xt_Generator_Table_ColumnMany_To_OneList[][COLUMN_NAME]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" data-bv-notempty data-bv-notempty-message="请输入" id="page_column_COMMENT'+uuid+'" value="'+column_COMMENT+'"  name="xt_Generator_Table_ColumnMany_To_OneList[][COLUMN_COMMENT]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" readonly id="page_data_TYPE'+uuid+'" value="'+item.data_TYPE+'"  name="xt_Generator_Table_ColumnMany_To_OneList[][DATA_TYPE]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" readonly id="page_character_MAXIMUM_LENGTH'+uuid+'" value="'+item.character_MAXIMUM_LENGTH+'"  name="xt_Generator_Table_ColumnMany_To_OneList[][CHARACTER_MAXIMUM_LENGTH]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" readonly id="page_is_NULLABLE'+uuid+'" value="'+item.is_NULLABLE+'"  name="xt_Generator_Table_ColumnMany_To_OneList[][IS_NULLABLE]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" readonly id="page_column_KEY'+uuid+'" value="'+column_KEY+'" name="xt_Generator_Table_ColumnMany_To_OneList[][COLUMN_KEY]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<select class="form-control" id="page_column_label_position'+uuid+'" name="xt_Generator_Table_ColumnMany_To_OneList[][column_label_position]" placeholder="请选择">'+
                            '<option value="">请选择</option>'+
                            '<option value="居左">居左</option>'+
                            '<option value="居上">居上</option>'+
                        '</select>'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<input class="form-control" type="text" maxlength="3" data-bv-numeric data-bv-numeric-message="此项为数字类型" id="page_column_label_anchor'+uuid+'" value="100"  name="xt_Generator_Table_ColumnMany_To_OneList[][column_label_anchor]">'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<select class="form-control" id="page_column_type'+uuid+'" name="xt_Generator_Table_ColumnMany_To_OneList[][column_type]" onchange=changePageType("'+uuid+'") placeholder="请选择">'+
                            '<option value="">请选择</option>'+
                            '<option value="文本框">文本框</option>'+
                            '<option value="文本域">文本域</option>'+
                            '<option value="下拉框">下拉框</option>'+
                            '<option value="文件框">文件框</option>'+
                        '</select>'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<select class="form-control" id="page_xt_script_id'+uuid+'" name="xt_Generator_Table_ColumnMany_To_OneList[][xt_script_id]" placeholder="请选择">'+
                            '<option value="">请选择</option>'+
                        '</select>'+
                    '</div>'+
                    '<div class="col-lg-1">'+
                        '<select class="form-control" id="page_isHidden'+uuid+'" name="xt_Generator_Table_ColumnMany_To_OneList[][isHidden]" placeholder="请选择">'+
                            '<option value="否">否</option>'+
                            '<option value="是">是</option>'+
                        '</select>'+
                    '</div>'+
                '</div>';
            $("#one_two_many_page_col_rows").append(rowsHtml);
            reValidator('defaultOneTwoManyPageConfigForm');
        });
        initOneTwoManyFieldsVal(id);//拿到之前数据赋值
        // setTimeout(function () {
        //
        // },5000)
    }, null,'POST');
}

/**
 * 刷新一对多从表字段列表
 */
function refreshOneTwoManyPageConfigList(){
    msgTishCallFnBoot("刷新可能会导致列表字段重置，确认刷新？",function(){
        var xt_dbinfo_id = $("#xt_dbinfo_id").val();
        var xt_generator_tbname = $("#otmtm").val();
        initOneTwoManyFields(xt_dbinfo_id,xt_generator_tbname);
    });
}


/**
 * 创建一对多从表字段配置
 */
function createOneTwoManyPageConfigColumnHeader() {
    validatorDestroy('defaultOneTwoManyPageConfigForm');
    $("#one_two_many_page_col_rows").empty();
    var rowsHtml =
        '<div class="form-group m-form__group row" style="background: #6f47d0;">'+
            '<label class="col-lg-2 col-form-label" style="color: #fff;" jEhcLang="COLUMN_NAME">字段</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="COLUMN_COMMENT">标签</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="DATA_TYPE">字段类型</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="CHARACTER_MAXIMUM_LENGTH">长度</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="IS_NULLABLE">必填</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="COLUMN_KEY">主键</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="column_label_position">位置</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="column_label_anchor">宽度</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="column_type">类型</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="xt_script_id">脚本</label>'+
            '<label class="col-lg-1 col-form-label" style="color: #fff;" jEhcLang="isHidden">隐藏</label>'+
        '</div>';
    $("#one_two_many_page_col_rows").append(rowsHtml);
    reValidator('defaultOneTwoManyPageConfigForm');
}

/**
 * 保存一对多从表字段至表格中
 */
function doSelectOneTwoManyFields() {
    if(getXtGeneratorFormListJSON() == false){
        return;
    }
    msgTishCallFnBoot("确认保存？",function(){
        var xt_dbinfo_id = $("#xt_dbinfo_id").val();
        var xt_generator_tbname = $("#otmtm").val();
        var formJson = getOneTwoManyFormListJSON();
        var id = $("#otmtmId").val();//获取当前行id
        $("#xt_generator_ontomany_grid"+id).val(formJson);
        $('#oneTwoManyFieldsModal').modal('hide');
    });
}


//验证并获取配置新增，编辑，明细等表单字段JSON规则
function getOneTwoManyFormListJSON(){
    var bootform = $('#defaultOneTwoManyPageConfigForm');
    var boostrapValidator =bootform.data('bootstrapValidator');
    boostrapValidator.validate();
    if(!boostrapValidator.isValid()){
        window.parent.toastrBoot(4,"存在不合法的字段!");
        return false;
    }
    // $.fn.serializeObject = function(){
    //     var o = {};
    //     var a = this.serializeArray();
    //     $.each(a, function() {
    //         if (o[this.name] !== undefined) {
    //             if (!o[this.name].push) {
    //                 o[this.name] = [o[this.name]];
    //             }
    //             o[this.name].push(this.value || '');
    //         } else {
    //             o[this.name] = this.value || '';
    //         }
    //     });
    //     return o;
    // };
    return JSON.stringify($("#defaultOneTwoManyPageConfigForm").serializeJSON());
}

/**
 * 一对多表单重新编辑赋值
 */
function initOneTwoManyFieldsVal(id){
    var formFieldJson = $("#xt_generator_ontomany_grid"+id).val();
    if(undefined != formFieldJson && null != formFieldJson && "" != formFieldJson ){
        //赋值
        formFieldJson = eval('(' + formFieldJson + ')');
        formFieldJson = formFieldJson.xt_Generator_Table_ColumnMany_To_OneList;
        for(var i = 0; i < formFieldJson.length; i++){
            document.getElementById("page_column_COMMENT"+i+id).value = formFieldJson[i].COLUMN_COMMENT;
            document.getElementById("page_column_label_position"+i+id).value = formFieldJson[i].page_column_label_position;
            document.getElementById("page_column_type"+i+id).value = formFieldJson[i].page_column_type;
            document.getElementById("page_xt_script_id"+i+id).value = formFieldJson[i].xt_script_id;
            document.getElementById("page_isHidden"+i+id).value = formFieldJson[i].isHidden;
            // console.log(id,$("#page_column_COMMENT"+i+id).val(),page_column_COMMENTList[i])
        }
        // var page_column_NAMEList = $.makeArray(formFieldJson["COLUMN_NAME"]);
        // var page_column_COMMENTList = $.makeArray(formFieldJson["COLUMN_COMMENT"]);
        // var page_column_label_positionList = $.makeArray(formFieldJson["column_label_position"]);
        // var page_column_typeList = $.makeArray(formFieldJson["column_type"]);
        // var page_xt_script_idList = $.makeArray(formFieldJson["xt_script_id"]);
        // var page_isHiddenList = $.makeArray(formFieldJson["isHidden"]);
        // for(var i = 0; i < page_column_NAMEList.length; i++){
        //     document.getElementById("page_column_COMMENT"+i+id).value = page_column_COMMENTList[i];
        //     document.getElementById("page_column_label_position"+i+id).value = page_column_label_positionList[i];
        //     document.getElementById("page_column_type"+i+id).value = page_column_typeList[i];
        //     document.getElementById("page_xt_script_id"+i+id).value = page_xt_script_idList[i];
        //     document.getElementById("page_isHidden"+i+id).value = page_isHiddenList[i];
        //     console.log(id,$("#page_column_COMMENT"+i+id).val(),page_column_COMMENTList[i])
        // }
    }
}